/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = (appInfo) => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + "_1753929968554_2628";

  // add your middleware config here
  config.middleware = ["unifiedResponse"];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  config.seleniumPool = {
    windowCount: 1, // 窗口数量
    idleTimeout: 1 * 60 * 1000, // 超时时间，3分钟
  };

  //跨域配置
  config.cors = {
    origin: "*", // 允许所有来源访问，生产环境建议指定具体域名
    allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH", // 允许的 HTTP 方法
    credentials: true, // 允许跨域请求携带 Cookie
    allowHeaders: "Content-Type,Authorization", // 允许的请求头
    exposeHeaders: "Content-Length,Date,Server", // 允许客户端获取的响应头
    maxAge: 86400, // 预检请求的缓存时间（秒）
  };

  //启动参数
  config.cluster = {
    listen: {
      port: 7001,
      hostname: "0.0.0.0",
    },
  };

  //csrf
  config.security = {
    csrf: {
      enable: false,
    },
    // 跨域白名单
    domainWhiteList: ["http://localhost:1024"],
  };

  //chrome-driver的地址
  // config.chromeDriver =
  //   "/www/wwwroot/tools/chromeDriver/chromedriver-linux64/chromedriver";

  config.chromeDriver = "D:\\142.0.7444.59\\chromedriver.exe";
  config.env = "local";
  return {
    ...config,
    ...userConfig,
  };
};
